package util;

import constant.Constant;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class LogUtils {




    public static void info(String msg,Object... arg){

        print(msg, Constant.INFO,arg);
    }


    public static void error(String msg,Object... arg){

        print(msg, Constant.ERROR,arg);
    }

    private static void print(String msg,String level,Object... args){


        if (StringUtils.isEmpty(msg)){

            msg= String.format(msg.replace("{}","%s"),args);

        }
        //获取当前线程名
        String name = Thread.currentThread().getName();

        System.out.println(LocalDateTime.now().format(DateTimeFormatter.ofPattern("hh:mm:ss"))+" "+ name +"-"+level+"-"+msg);
    }
}
